package services.base;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ExecuteSP {
	DataSourceService ds = null;
	Connection con = null;
	ResultSet rs = null;

	public ExecuteSP() {
		ds = new DataSourceService();
		con = ds.getConnection();
	}

	public ResultSet executeSP(String proc) throws SQLException {

		try {
			CallableStatement cs = con.prepareCall(proc);
			cs.execute();
			rs = cs.getResultSet();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return rs;
	}

	public void closeConnection() throws SQLException {
		ds.closeConnection();
	}
}
